package com.wm.web.controller.system;


import com.wm.common.core.controller.BaseController;
import com.wm.common.core.domain.AjaxResult;
import com.wm.common.core.page.TableDataInfo;
import com.wm.system.domain.ShopInfo;
import com.wm.system.service.IShopInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hyq
 * @since 2023-10-09 12:01:56
 */
@RestController
@RequestMapping("/system/shopInfo")
public class ShopInfoController extends BaseController {

    @Autowired
    private IShopInfoService service;

    @ApiOperation("我的店铺分页查询")
    @GetMapping("list")
    public TableDataInfo list(ShopInfo shopInfo){
        startPage();
        List<ShopInfo> info = service.selectShopInfoList(shopInfo);
        return getDataTable(info);
    }

    @ApiOperation("我的店铺新增和修改")
    @PostMapping("addOrUpdate")
    public AjaxResult addOrUpdate(@RequestBody ShopInfo shopInfo){
        service.addOrUpdate(shopInfo);
        return AjaxResult.success();
    }

    @ApiOperation("我的店铺单个查询")
    @PostMapping("getInfo")
    public AjaxResult getInfo(@RequestBody ShopInfo shopInfo){
        ShopInfo info = service.getInfo(shopInfo);
        return AjaxResult.success(info);
    }

}
